#/usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import pymel.core as pmel


class Validation():
    name = u'Keyframe | 关键帧检查'
    dataDict = dict()

    def execute(self):
        self.dataDict = {}
        objList = pmel.ls(tr=1)
        for obj in objList:
            keyAttrList = pmel.keyframe(obj, q=1, name=1)
            if keyAttrList:
                self.dataDict[obj.name()] = keyAttrList
        return self.dataDict

    def correct(self):
        if self.dataDict:
            for k, attrList in self.dataDict.items():
                for attr in attrList:
                    # attr_node = pmel.PyNode(attr)
                    pmel.delete(attr)

    def search(self, obj):
        pmel.select(obj)
